function validateform( )
{
	// check that all name fields are filled
	if ( document.userdata.txtUsername.value.match(/^\s*$/)
				|| document.userdata.pwdPassword.value.match(/^\s*$/)
				|| document.userdata.pwdPassword2.value.match(/^\s*$/) )
	{
		alert("Sorry, all personal info fields are required and must be filled out.\nAll white space passwords are not allowed.");
		return; // stop processing if any of these fail
	}

	// if both are blank, they are still equal
	if (document.userdata.pwdPassword.value == document.userdata.pwdPassword2.value)
	{
		if (document.userdata.pwdPassword.value.substring(0,5) != '!md5!')
		{
			document.userdata.pwdPassword.value = '!md5!' + hex_md5(document.userdata.pwdPassword.value);
			document.userdata.pwdPassword2.value = '!md5!' + hex_md5(document.userdata.pwdPassword2.value);
		}
		md5pass(true);
		document.userdata.submit( );
	}
	else
	{
		alert("Sorry, the two password fields don't match.  Please try again.");
	}
}


function md5pass(two)
{
	var passbox = document.getElementById('pwdPassword');
	passbox.blur( ); // remove the focus so we don't erase the data

	if (passbox.value.substring(0, 5) != '!md5!')
	{
		passbox.value = '!md5!' + hex_md5(passbox.value);
	}

	if (two)
	{
		var passbox2 = document.getElementById('pwdPassword2');
		passbox2.blur( ); // remove the focus so we don't erase the data

		if (passbox2.value.substring(0, 5) != '!md5!')
		{
			passbox2.value = '!md5!' + hex_md5(passbox2.value);
		}
	}
}